<?php
header("Content-Type: text/html; charset=utf-8");
include_once ('core/controller.php');
$controller = new Controller(); 
if (!isset($_POST['autor'])) $_POST['autor'] = '';
if (!isset($_POST['text'])) $_POST['text'] = ''; 
?>
<html>
<head>
    <title>Гостевая книга</title>
    <link rel="stylesheet" type="text/css" href="assets/template.css">
    <script src="assets/jquery-2.1.1.min.js"></script>
    <script src="assets/jquery.autosize.min.js"></script>
    <script src="assets/template.js"></script>
</head>
<body>
<div class="head"><span>Гостевая книга</span><button id="addpostb">Добавить Сообщение</button></div>
<div class="main">
    <div class="addform" id="addform">
        <div id="titleform">Добавить собщение:</div>
        <form action="guestbook.php"  method="post">
            <label>Имя: </label>
            <input type="text" name="autor" value="<?php echo $_POST['autor']; ?>" placeholder="Ваше имя" />
            <br />
            <label>Текст собщения: </label>
            <textarea rows="10" cols="45" name="text"><?php echo $_POST['text']; ?></textarea>
            <input type="hidden" name="id" id="idform" value="0" />
            <input type="hidden" name="task" id="taskform" value="" />
            <div style="clear: both;"></div>
            <input type="submit" id="submit" />
        </form>
    </div>
    <div class="postlist" id="postlist">
        <?php $controller->display(); ?>
    </div>
</div>
</body>
</html>